package cn.kgm.makeGodV2.ruleEngine;

/**
 * @Version 1.8
 * @Author: Kappi
 * @Date: 2025-9-25 14:05
 * @Description: cn.kgm.makeGodV2.ruleEngine.NotConditionRule
 */
public class NotConditionRule implements RuleStrategy<Boolean> {
    @Override
    public String getRuleType() {
        return "NOT";
    }

    @Override
    public boolean validate(RuleContext context) {
        ConditionConfig conditionConfig = context.getParam("conditionConfig", ConditionConfig.class);
        return conditionConfig != null && conditionConfig.getConditions() != null && conditionConfig.getConditions().size() == 1;
    }

    @Override
    public RuleResult<Boolean> execute(RuleContext context) {
        ConditionConfig conditionConfig = context.getParam("conditionConfig", ConditionConfig.class);
        return ConditionExecutor.executeNotCondition(conditionConfig, context);
    }
}
